package com.headfirst.StructuralMode.adapter;

public class DuckTestDriver {
    public static void main(String[] args) {
        
        // 创建一只鸭子和一只火鸡
        Duck duck = new MallarDuck();
        Turkey turkey = new WildTurkey();

        // 将火鸡包装进火鸡适配器中
        Duck turkeyAdapter = new TurkeyAdapter(turkey);

        System.out.println("The Turkey says...");
        turkey.gobble();
        turkey.fly();

        System.out.println("\nThe Duck says...");
        testDuck(duck);

        System.out.println("\nThe TurkeyAdapter says...");
        testDuck(turkeyAdapter);
    }

    private static void testDuck(Duck duck) {
        duck.quack();
        duck.fly();
    }
}
